//
//  KDAddKeywordView.m
//  PublicSentimentMonitorSystem
//
//  Created by 魏强 on 15/11/4.
//  Copyright © 2015年 魏强. All rights reserved.
//

#import "KDAddKeywordView.h"
@interface KDAddKeywordView ()
@property (weak, nonatomic) IBOutlet UILabel *nameLb;
/**
 *  选择状态label
 */
@property (weak, nonatomic) IBOutlet UILabel *chosenLb;
@property (weak, nonatomic) IBOutlet UIButton *addKeywordBtn;

@end
@implementation KDAddKeywordView

#pragma mark -板块设置区
+ (instancetype)addKeywordView{
    KDAddKeywordView *wordView = [[[NSBundle mainBundle] loadNibNamed:@"KDAddKeywordView" owner:nil options:nil]lastObject];
    return wordView;
}
- (void)setName:(NSString *)name{
    _name = name;
    self.nameLb.text = name;
}
- (void)setEnable:(BOOL)enable{
    _enable = enable;
    self.addKeywordBtn.enabled = enable;
    if (!enable) {
        self.nameLb.textColor = [UIColor grayColor];
    }
}
- (void)drawRect:(CGRect)rect{
    [super drawRect:rect];
    self.layer.borderColor = [UIColor colorWithRed:224/225.0 green:232/225.0  blue:221/225.0  alpha:0.43].CGColor;
    self.layer.borderWidth = 0.3;
    KDLog(@"%@", NSStringFromCGRect(self.frame));
}
- (IBAction)viewDidSelect:(UIButton *)sender {
    if (_delegate && [_delegate respondsToSelector:@selector(KDAddKeywordView:DidSelectWithType:)]) {
        [_delegate KDAddKeywordView:self DidSelectWithType:self.type];
    }
}
/**
 *  已选择了
 */
- (void)setChosen:(BOOL)chosen{
    _chosen = chosen;
    self.chosenLb.hidden = !chosen;
}
@end
